﻿<table class="table table-bordered">
    <thead>
        <tr>
            <th scope="col">#</th>
            <th scope="col">
                <a href="/sort?by=name&order=@(ViewBag.SortBy.Equals("name") & ViewBag.SortOrder.Equals("asc") ? "desc" : "asc")">Наименование пакета</a>
                @(ViewBag.SortBy.Equals("name") ? (ViewBag.SortOrder.Equals("asc") ? "\u0020\u2191" : "\u0020\u2193") : string.Empty)
            </th>
            <th scope="col">
                <a href="/sort?by=size&order=@(ViewBag.SortBy.Equals("size") & ViewBag.SortOrder.Equals("asc") ? "desc" : "asc")">Размер, МБ</a>
                @(ViewBag.SortBy.Equals("size") ? (ViewBag.SortOrder.Equals("asc") ? "\u0020\u2191" : "\u0020\u2193") : string.Empty)
            </th>
            <th scope="col">
                <a href="/sort?by=dateTimeCreated&order=@(ViewBag.SortBy.Equals("dateTimeCreated") & ViewBag.SortOrder.Equals("asc") ? "desc" : "asc")">Дата создания</a>
                @(ViewBag.SortBy.Equals("dateTimeCreated") ? (ViewBag.SortOrder.Equals("asc") ? "\u0020\u2191" : "\u0020\u2193") : string.Empty)
            </th>
            <th scope="col">Параметры</th>
            <th scope="col">Исходный файл</th>
        </tr>
    </thead>
    <tbody>
        @{
            int i = 1;
            foreach (var package in ViewBag.Packages)
            {
                <tr>
                    <td>@i</td>
                    <td><a href="@package.Url">@package.Name</a></td>
                    <td>@Math.Floor(package.Size / 1048576d)</td>
                    <td>@package.DateTimeCreated.ToString("dd.MM.yyyy HH:mm:ss")</td>
                    <td>@package.Parameters</td>
                    <td><a href="@package.Url&original=true">Извлечь</a></td>
                </tr>
                i++;
            }
        }
    </tbody>
</table>
